import React, { Component } from "react";
import Count from "./Count";

import { connect } from "react-redux";
import { loadAction } from "./store/actionCreator";

const mapDispatchToProps = (dispatch) => {
  return {
    load() {
      dispatch(loadAction());
    },
  };
};

class App extends Component {
  render() {
    return (
      <>
        <h3>redux计数器</h3>
        <Count />
      </>
    );
  }

  componentDidMount() {
    this.props.load();
  }
}

export default connect(null, mapDispatchToProps)(App);
